﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Graphics;
using Utilities.XNA.Graphics;

namespace SceneManager
{
    /// <summary>
    /// Represents a material to be displayed
    /// </summary>
    public class Material
    {
        public static Game Game { get; set; }

        /// <summary>
        /// Gets or sets the texture of this material
        /// </summary>
        public Texture2D Texture { get; set; }
        /// <summary>
        /// Gets or sets the normal map of this material
        /// </summary>
        public Texture2D NormalMap { get; set; }

        // SpecularMap

        /// <summary>
        /// Gets or sets the specular intensity of this material
        /// </summary>
        public float SpecularIntensity { get; set; }
        /// <summary>
        /// Gets or sets the specular power of this material
        /// </summary>
        public float SpecularPower { get; set; }

        /// <summary>
        /// Initializes a new instance of the Material class with the specified color and the default specular values
        /// </summary>
        /// <param name="color">The color of the material</param>
        public Material(Color color)
        {
            Texture = Texture2DHelper.GeneratePixel(Game.GraphicsDevice, color);
            NormalMap = Texture2DHelper.GeneratePixel(Game.GraphicsDevice, new Color(0.5f, 0.5f, 1.0f));
            SpecularIntensity = 1;
            SpecularPower = 1;
        }
        /// <summary>
        /// Initializes a new instance of the Material class with specified texture, specular intensity and specular power
        /// </summary>
        /// <param name="texture">The texture of the material</param>
        /// <param name="specularIntensity">The specular intensity of the material</param>
        /// <param name="specularPower">The specular power of the material</param>
        public Material(string texture, float specularIntensity, float specularPower)
        {
            Texture = Game.Content.Load<Texture2D>(texture);
            SpecularIntensity = specularIntensity;
            SpecularPower = specularPower;
        }
        /// <summary>
        /// Initializes a new instance of the Material class with specified texture, specular intensity and specular power
        /// </summary>
        /// <param name="texture">The texture of the material</param>
        /// <param name="specularIntensity">The specular intensity of the material</param>
        /// <param name="specularPower">The specular power of the material</param>
        public Material(Texture2D texture, float specularIntensity, float specularPower)
        {
            Texture = texture;
            SpecularIntensity = specularIntensity;
            SpecularPower = specularPower;
        }
    }
}